package cn.syy.autoconfigure;

import cn.syy.config.SaTokenConfigure;
import cn.syy.config.StpInterfaceImpl;
import cn.syy.interceptor.FeignTokenInterceptor;
import cn.syy.propertites.SaTokenSettingProperties;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

@Configuration
@EnableConfigurationProperties({SaTokenSettingProperties.class}) // 读取配置类
public class SaTokenAutoConfiguration {
    @Bean
    public SaTokenConfigure saTokenConfig(){
        return new SaTokenConfigure();
    }

    @Bean
    public StpInterfaceImpl stpInterfaceImpl(RedisTemplate redisTemplate, SaTokenSettingProperties saTokenSettingProperties){
        return new StpInterfaceImpl(redisTemplate,saTokenSettingProperties);
    }
    @Bean
    public FeignTokenInterceptor feignTokenInterceptor(){
        return new FeignTokenInterceptor();
    }



}
